<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of class
 *
 * @author ������
 */
class MessagesObserver implements IObserver{
     

    private $registry;
    
    public function __construct() {
        $this->registry = Registry::getInstance();
        $themeunit = $this->registry->themeunit;
        //if(session_status()) session_start();
        //if(isset($_SESSION['messages'])) $themeunit->data['messages'] = $_SESSION['messages'];
        //$_SESSION['messages'] = array();
    }
    public function notify($eventType, $data) {
        switch ($eventType) {
            case 'message':
                $themeunit = $this->registry->themeunit;
       
                //$hash = md5($data['message']);
                //if(!key_exists($hash, $_SESSION['messages']))
                //{
                    $themeunit->data['messages'][] = $data;
                    //$_SESSION['messages'][$hash] = $data;
                //}
                break;

            default:
                break;
        }
    }
}
?>
